<template>
	<view>
		<view class="information">
			<view class="mask" v-show="mask" @click="changeMask"></view>
			<view class="information-span">
				<view class="information-span-icon"></view>
				<view>个人信息</view>
			</view>
			<view class="changesex" v-show="mask">
				<view class="sex" @click="changeSex(1)">男</view>
				<view class="sex" @click="changeSex(2)" style="border-top: rgb(153,153,153,0.5) solid 1px;">女</view>
			</view>
			<view class="w">
				<view class="information-petname" @click="touchendSex">
					<view class="information-petname-left">
							<view class="petname-title">性别</view>
							<view class="petname">{{this.users.sex}}</view>
					</view>
					<view class="iconfont iconarrow"></view>
				</view>
				<view class="information-birthday">
					<view class="information-birthday-left">
							<view class="birthday-title">生日</view>
							<view class="birthday">
								<view>
									<text>{{this.users.birthday}}</text><text style="margin-left: 8px;">{{this.users.constellation}}</text>
								</view>
								<view class="birthday-change">仅显示星座</view>
							</view>
					</view>
					<view class="iconfont iconarrow"></view>
				</view>
				<view class="information-petname">
					<view class="information-petname-left">
							<view class="petname-title">感情状况</view>
							<view class="petname">{{this.users.emotionalState}}</view>
					</view>
					<view class="iconfont iconarrow"></view>
				</view>
				<view class="information-petname">
					<view class="information-petname-left">
							<view class="petname-title">所在地</view>
							<view class="petname">{{this.users.address}}</view>
					</view>
					<view class="iconfont iconarrow"></view>
				</view>
				<view class="information-petname">
					<view class="information-petname-left">
							<view class="petname-title">家乡</view>
							<view class="petname">山东</view>
					</view>
					<view class="iconfont iconarrow"></view>
				</view>
				<view>
					<view class="information-school">
						<view class="information-school-left">
								<view class="school-title">大学</view>
								<view class="school">
									<view>青岛酒店管理学院</view>
									<view style="letter-spacing: 0.1px;">(2015)</view>
									<view>烹饪院</view>
								</view>
						</view>
						<view class="iconfont iconarrow"></view>
					</view>
				</view>
				<view class="school-more">
					添加更多教育信息
				</view>
				<view class="information-petname">
					<view class="information-petname-left">
							<view class="petname-title">公司</view>
							<view class="petname">山东</view>
					</view>
					<view class="iconfont iconarrow"></view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import utils from '../../../../utils/util.js'
export default{
	name: 'personalInformation',
	props: {
		users: {},
		userId: ''
	},
	data() {
		return {
			mask: false,
		}
	},
	methods: {
		touchendSex() {
			this.mask = true;
		},
		changeSex(e) {
			if(e == 1)
			{
				if(this.users.sex !== "男")
				{
					this.users.sex = "男";
					uni.removeStorage({
					    key: userID+'userInfo',
					    success: function (res) {
					        console.log('success');
					    }
					});
					const userID = this.userId;
					utils.setStorageData(userID+'userInfo',this.users);
				}
				this.mask = false;
			}else if(e == 2) {
				if(this.users.sex !== "女")
				{
					this.users.sex = "女";
					uni.removeStorage({
					    key: '15092095518userInfo',
					    success: function (res) {
					        console.log('success');
					    }
					});
					const userID = this.userId;
					utils.setStorageData(userID+'userInfo',this.users);
				}
				this.mask = false;
			}
		},
		changeMask() {
			this.mask = false;
		}
	}
}
</script>

<style>
	.mask{
		background-color: rgb(0,0,0,0.4);
		position: absolute; 
		top: -20px;
		left: 0;
		right: 0;
		bottom: -10px;
		z-index: 999;
	}
	.information{
		margin-bottom: 10px;
		background-color: #fff;
	}
		.information-span{
			display: flex;
			align-items: center;
			color: #555555;
			font-size: 15px;
			height: 32px;
			letter-spacing: 1px;
		}
			.information-span-icon{
				height: 20px;
				width: 3px;
				background-color: #FE6440;
				border-radius: 10px;
				margin-right: 10px;
			}
		.w{
			margin-left: 10px;
			margin-right: 10px;
		}
			.information-petname{
				height: 44px;
				display: flex;
				align-items: center;
				justify-content: space-between;
				border-top: rgb(153,153,153,0.5) solid 1px;
			}
				.iconarrow{
					font-size: 38px;
					transform:rotate(270deg);
				}
				.information-petname-left{
					width: 240px;
					height: 42px;
					display: flex;
					align-items: center;
				}
					.petname-title{
						width: 80px;
						font-size: 15px;
						letter-spacing: 1px;
					}
					.petname{
						font-size: 15px;
						letter-spacing: 1px;
						color: rgb(0,0,0,0.8);
					}
			.information-birthday{
				height: 74px;
				display: flex;
				align-items: center;
				justify-content: space-between;
				border-top: rgb(153,153,153,0.5) solid 1px;
			}
				.information-birthday-left{
					width: 240px;
					height: 52px;
					display: flex;
				}
					.birthday-title{
						width: 80px;
						font-size: 15px;
						letter-spacing: 1px;
					}
					.birthday{
						font-size: 15px;
						letter-spacing: 1px;
						color: rgb(0,0,0,0.8);
						display: flex;
						flex-direction: column;
						justify-content: space-between;
					}
						.birthday-change{
							font-size: 12px;
							height: 23px;
							width: 80px;
							border-radius: 5px;
							display: flex;
							align-items: center;
							justify-content: center;
							border: rgb(153,153,153,0.4) solid 1px;
						}
			.information-school{
				height: 80px;
				display: flex;
				align-items: center;
				justify-content: space-between;
				border-top: rgb(153,153,153,0.5) solid 1px;
			}
				.information-school-left{
					width: 240px;
					height: 58px;
					display: flex;
				}
					.school-title{
						width: 80px;
						font-size: 15px;
						letter-spacing: 1px;
					}
					.school{
						font-size: 15px;
						letter-spacing: 1px;
						color: rgb(0,0,0,0.8);
						display: flex;
						flex-direction: column;
						justify-content: space-between;
					}
			.school-more{
				border-top: rgb(153,153,153,0.5) solid 1px;
				height: 30px;
				font-size: 13px;
				color: #007AFF;
				display: flex;
				align-items: center;
				justify-content: center;
			}
		.changesex{
			position: absolute;
			width: 200px;
			height: 70px;
			background-color: #fff;
			z-index: 9999;
			left: 83px;
			top: 240px;
			border-radius: 15px;
			border: rgb(153,153,153,0.8) solid 1px;
		}
			.sex{
				height: 34.5px;
				display: flex;
				align-items: center;
				text-indent: 20px;
			}
</style>
